<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: www
  Date: 2021/10/25
  Time: 14:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>会员详情</title>
    <link type="text/css" rel="stylesheet" href="fontsawesome/css/font-awesome.css"/>
    <link type="text/css" rel="stylesheet" href="css/style.css"/>
</head>
<body>
<div class="main_box">
    <div class="cont_box">
        <!--会员姓名电话-->
        <div class="user_top" id="${member.mid}"><b>${member.name}</b><span>${member.phone}</span></div><!--这里的id是用户id-->
        <!--车辆情况-->
        <div class="user_detail">
            <h2><span></span>车辆情况</h2>
            <div class="clearfix">
                <c:forEach items="${memberCars}" var="memberCars">
                <ul>
                    <li>
                        <label>品牌</label>
                        <span>${memberCars.car_brand}</span>
                    </li>
                    <li>
                        <label>系列</label>
                        <span>${memberCars.car_series}</span>
                    </li>
                    <li>
                        <label>型号</label>
                        <span>${memberCars.car_brand}${memberCars.car_model}</span>
                    </li>
                    <li>
                        <label>发动机号</label>
                        <span>${memberCars.car_engine}</span>
                    </li>
                    <li>
                        <label>车牌号</label>
                        <span>${memberCars.c_number}</span>
                    </li>
                    <li>
                        <label>行驶里程</label>
                        <span>${memberCars.car_travel}公里</span>
                    </li>
                    <li>
                        <label>行驶证</label>
                        <span>${memberCars.car_driving}</span>
                    </li>
                    <li>
                        <label>年份</label>
                        <span><fmt:formatDate value="${memberCars.car_year}"></fmt:formatDate></span>
                    </li>
                    <li>
                        <label>指导价</label>
                        <span>${memberCars.car_price}</span>
                    </li>
                    <li>
                        <label>保险到期日</label>
                        <span><fmt:formatDate value="${memberCars.car_expire}"></fmt:formatDate></span>
                    </li>
                </ul>
                </c:forEach>
            </div>
        </div>
        <!--车辆情况-->
        <div class="user_detail">
            <h2><span></span>储值卡情况</h2>
            <table border="0" cellspacing="0" cellpadding="0" class="table">
                <thead>
                <tr>
                    <th>卡片ID</th>
                    <th>卡片种类</th>
                    <th>卡片余额</th>
                    <th>卡片折扣</th>
                    <th>办理店铺</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${memberCards}" var="memberCards">
                    <c:if test="${memberCards.clamp.equals('储值卡')}">
                <tr>
                    <td>${memberCards.card}</td>
                    <td>${memberCards.clamps}</td>
                    <td>${memberCards.number}</td>
                    <td>${memberCards.discount}</td>
                    <td>${memberCards.store}</td>
                </tr>
                    </c:if>
                </c:forEach>
                </tbody>
            </table>
        </div>
        <!--年卡情况-->
        <div class="user_detail">
            <h2><span></span>年卡情况</h2>
            <table border="0" cellspacing="0" cellpadding="0" class="table">
                <thead>
                <tr>
                    <th>卡片额度</th>
                    <th>办理日期</th>
                    <th>过期日期</th>
                    <th>状态</th>
                    <th>办理店铺</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${memberCards}" var="memberCards">
                    <c:if test="${memberCards.clamp.equals('年卡')}">
                <tr>
                    <td>${memberCards.number}</td>
                    <td><fmt:formatDate value="${memberCards.cTime}"></fmt:formatDate></td>
                    <td><fmt:formatDate value="${memberCards.endTime}"></fmt:formatDate></td>
                    <td>${memberCards.state}</td>
                    <td>${memberCards.store}</td>
                </tr>
                    </c:if>
                </c:forEach>
                </tbody>
            </table>
        </div>
        <!--大礼包情况-->
        <div class="user_detail">
            <h2><span></span>大礼包情况</h2>
            <table border="0" cellspacing="0" cellpadding="0" class="table">
                <thead>
                <tr>
                    <th>礼包名称</th>
                    <th>大礼包价格</th>
                    <th>办理日期</th>
                    <th>过期日期</th>
                    <th>办理店铺</th>
                    <th>礼包详情</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach  items="${memberGifts}" var="memberGifts">
                    <c:if test="${memberGifts.state.equals('可使用')}">
                <tr id="${memberGifts.gid}"><!--这里的id是用户礼包id-->
                    <td>${memberGifts.giftnum}</td>
                    <td>${memberGifts.price}</td>
                    <td><fmt:formatDate value="${memberGifts.tion_time}"></fmt:formatDate></td>
                    <td><fmt:formatDate value="${memberGifts.guotime}"></fmt:formatDate></td>
                    <td>${memberGifts.salesman}</td>
                    <td>
                        <a href="javascript:void(0);" class="table_btn table_info see_btn">
                            <i class="fa fa-eye"></i>
                            <span>查看</span>
                        </a>
                    </td>
                </tr>
                    </c:if>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>
<!--javascript include-->
<script src="js/jquery-2.2.1.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/other.js"></script>
<script>
    $(function(){
        //=====弹出窗设置
        function DelTipWidth(Twidth,Theight){
            $(".tipbox_top",window.parent.document).css({"width":Twidth+"px","height":Theight+"px","margin-top":-(Theight/2)+"px","margin-left":-(Twidth/2)+"px"});
            $(".tiptop_close",window.parent.document).on("click",function(){
                $(".tipbg_top",window.parent.document).remove(); //移除新增的背景className
                $(".tipbox_top",window.parent.document).remove(); //移除新增的外层className
            });
        }
        $(".see_btn").click(function(){
            var boxId = $(this).parents("tr").prop("id"),
                userId = $("user_top").prop("id"),
                tipBg = "<div class='tip_bg tipbg_top'></div>",
                tipBox = "<div class='tip_box tipbox_top'></div>",
                Wparent = window.parent.document;
            $.ajax({
                type:"get",
                url:"${pageContext.request.contextPath}/selectOneGiftController",
                data:{"userId":userId,"bixId":boxId},
                success:function(){
                    $("body",Wparent).append(tipBg);
                    $("body",Wparent).append(tipBox);
                    $(".tipbox_top",Wparent).prepend("<h2>礼包详情<span class='tiptop_close'><i class='fa fa-close'></i></span></h2><div class='tip_tbox tiptop_box'></div>");
                    $(".tiptop_box",Wparent).append("<iframe src='${pageContext.request.contextPath}/selectOneGiftController?bixId="+boxId+"' frameborder='0' width='100%' height='100%' seamless></iframe>");
                    DelTipWidth(660,420);
                    var titH = $(".tipbox_top",Wparent).find("h2").outerHeight(),
                        Theight = $(".tipbox_top",Wparent).height();
                    $(".tiptop_box",Wparent).css("height",Theight - titH);
                },
                error:function(errormsg){
                    var editFail = "<p class='del_info'>"+errormsg+"</p><div class='tip_btnbox'><button class='btn btn_dsure tiptop_close'>确认</button></div>";
                    $("body",Wparent).append(tipBg);
                    $("body",Wparent).append(tipBox);
                    $(".tipbox_top",Wparent).append(editFail);
                    DelTipWidth(400,180);
                }
            });
        });
    });
</script>
</body>
</html>
